package com.imooc.study.imoocstudy.tkmybatis.controller;

import com.imooc.study.imoocstudy.tkmybatis.entity.User;
import com.imooc.study.imoocstudy.tkmybatis.mapper.UserMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class HelloTkMybatisController {

    @Resource
    private UserMapper userMapper;

    @GetMapping("/helloName")
    public String helloName(){

        List<User> lists = userMapper.selectAll();

        return "hello~"+lists.get(0).getName();
    }

    @GetMapping("/testCommon")
    public List<User> testCommon(){

        List<User> list = userMapper.selectTestGet();
        return list;
    }

}
